package www.openteam.com.presenter;

import java.util.HashMap;

import www.openteam.com.base.BasePresenter;
import www.openteam.com.bean.UpdateTypeInfo;
import www.openteam.com.contract.SplishDownLoadContract;
import www.openteam.com.model.SplishDownloadModel;
import www.openteam.com.mvp.IModel;
import www.openteam.com.tool.LogUtils;
import www.openteam.com.ui.SplashActivity;

/**
 * Created by kylin on 2017/2/20.
 */

public class SplishDownloadPresenter extends BasePresenter<SplashActivity>
                               implements SplishDownLoadContract.SplishDownLoadPresenter{
    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new SplishDownloadModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {

        HashMap<String ,IModel> hashMap =new HashMap<>();
        hashMap.put("splishDownload",models[0]);

        return hashMap;
    }

    @Override
    public void queryUpdateInfo(int vc) {
        ((SplishDownloadModel) getiModelMap().get("splishDownload"))
                .queryUpdateInfo(vc, new SplishDownloadModel.SplishDownLoadOnListener() {
                    @Override
                    public void queryUISuccess(UpdateTypeInfo updateTypeInfos) {
                                getIView().queryUISuccess(updateTypeInfos);
                    }

                    @Override
                    public void queryUIFail(String failMsg) {
                        LogUtils.d(LoginPresenter.class.getSimpleName() +
                                "r.failInfo", failMsg);
                        getIView().queryUIFail(failMsg);
                    }
                });
    }
}
